package com.study.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
@Data
public class User {
    @Value("${myframe.user.name}")
    private String name;
    @Value("${myframe.user.age}")
    private Integer age;
    @Value("${myframe.user.address}")
    private String address;
    @Value("${myframe.user.desc}")
    private String desc;
    @Value("${myframe.user.uuid}")
    private String uuid;
    @Value("${myframe.user.phone:13509654884}")  //如果没有phone 配置文件，系统就会报错，所以制定13509654884默认值
    private String phone;
    @Value("${myframe.user.date}")
    private Date date;
//    @Value("${myframe.user.hobby}") //报错：Could not resolve placeholder 'myframe.user.hobby' in value "${myframe.user.hobby}"
    @Value("#{'${myframe.user.hobbys}'.split(',')}")
    private List<String> hobby;
    @Value("#{${myframe.user.maps}}")
    private Map<String, String> maps;

}
